package it.rap.applications.birt.report.accounts.core;

import it.rap.applications.birt.report.accounts.services.BirtDownloadServiceHandler;
import it.rap.applications.birt.report.accounts.services.DownloadServiceHandler;
import it.rap.applications.contributions.manager.services.IDownloadServiceHandler;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.service.ServiceHandler;
import org.eclipse.rap.rwt.service.ServiceManager;

public class CustomReport {
	protected static ServiceManager manager = null;

	public CustomReport(){
		if( manager == null ){
			manager = RWT.getServiceManager();
			
		}
		
		IDownloadServiceHandler handler = new DownloadServiceHandler();	
		IDownloadServiceHandler birtHandler = new BirtDownloadServiceHandler();
				
		try{
			manager.registerServiceHandler( DownloadServiceHandler.ID, (ServiceHandler)handler );
			manager.registerServiceHandler( BirtDownloadServiceHandler.ID, (ServiceHandler)birtHandler );
		} catch( IllegalArgumentException e ){
			Logger.getAnonymousLogger().log(Level.SEVERE, e.getMessage());
		}
	}
}
